package demo1;
//import java.util.Scanner;
//
//public class demo1.Main {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int[] height = new int[10];
//        for(int i =0 ; i<10; i++) {
//            height[i] = scanner.nextInt();
//        }
//        int m = scanner.nextInt();
//
//        int count = 0;
//        for(int i = 0; i<10; i++) {
//            if(m + 30 >= height[i]) {
//                count++;
//            }
//        }
//        System.out.println(count);
//    }
//}
//




import java.util.Scanner;

public class Main {
    static int[] month = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    static int[] hash = {0,  0,  1,  1,  0,  1,  0,  1,  0,  0,  0,  1,  0};
    //闰年一年的收入
    static int salary1 = 580;
    //平年一年的收入
    static int salary2 = 579;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while(scanner.hasNextInt()) {
            int y1 = scanner.nextInt();
            int m1 = scanner.nextInt();
            int d1 = scanner.nextInt();

            int y2 = scanner.nextInt();
            int m2 = scanner.nextInt();
            int d2 = scanner.nextInt();

            int sum = 0;

            //统计第一年的收入
            //int m = 1, d = 1;
            if(y1 != y2) {
                if (check(y1)) month[2] = 29;
                else month[2] = 28;
                for (int m = m1+1; m <=12; m++) {
                    if (hash[m] == 1) {
                        sum += month[m];
                    } else {
                        sum += month[m] * 2;
                    }
                }
                if(hash[m1] == 1) {
                    sum += (month[m1]-d1+1);
                }else {
                    sum += (month[m1]-d1+1)*2;
                }

                //统计最后一年的收入
                if (check(y2)) month[2] = 29;
                else month[2] = 28;
                for(int m = 1;m<m2; m++) {
                    if (hash[m] == 1) {
                        sum += month[m];
                    } else {
                        sum += month[m] * 2;
                    }
                }
                if(hash[m2] == 1) {
                    sum += d2;
                }else {
                    sum += d2*2;
                }

                //统计中间整年的收入
                for(int y = y1+1; y<y2; y++){
                    if(check(y)) {
                        sum += salary1;
                    }else {
                        sum += salary2;
                    }
                }

            }else {
                //y1 == y2
                int m = m1, d = d1;
                while(m!=m2 || d!=d2) {
                    if(hash[m] == 1) sum += 1;
                    else sum += 2;

                    d++;
                    if(d == month[m] + 1) {
                        d = 1;
                        m++;
                    }
                }
                if(hash[m] == 1) sum += 1;
                else sum += 2;
            }

            System.out.println(sum);
        }
    }
    public static boolean check(int y) {
        if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
            return true;
        }
        return false;
    }
}